﻿<!--
Project: ClipFlair (http://ClipFlair.codeplex.com)
Filename: AudioRecorderControl.xaml
Version: 20150323
-->

<UserControl
    x:Class="ClipFlair.AudioRecorder.AudioRecorderControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:utils="clr-namespace:System.Windows.Controls;assembly=Compatibility"
    xmlns:btn="clr-namespace:ImageButtons;assembly=ImageButtons"
    mc:Ignorable="d" d:DesignHeight="30" d:DesignWidth="116"
    >

  <UserControl.Resources>
    <ResourceDictionary>
      <utils:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </ResourceDictionary>
  </UserControl.Resources>

  <DockPanel x:Name="LayoutRoot">

    <MediaElement
      x:Name="player"
      Visibility="Collapsed"
      DockPanel.Dock="Top"
      />

    <ProgressBar
      x:Name="progress"
      Foreground="Green"
      Background="LightGray"
      Height="5"
      Margin="0,-1"
      BorderThickness="0"
      BorderBrush="Transparent"
      DockPanel.Dock="Bottom"
      Visibility="{Binding Path=DrawDuration, Converter={StaticResource BooleanToVisibilityConverter}}"
      />

    <StackPanel Orientation="Horizontal">

      <btn:ImageToggleButton
        x:Name="btnRecord"
        Visibility="{Binding Path=RecordCommand.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
        IsEnabled="{Binding Path=RecordCommand.IsEnabled, Mode=TwoWay}"
        IsChecked="{Binding Path=RecordCommand.IsChecked, Mode=TwoWay}"
        Margin="3,0,0,0"
        ToolTipService.ToolTip="Record audio"
        Image="Images/Record.png"
        ImageHover="Images/Record_hover.png"
        ImageChecked="Images/Stop.png"
        ImageCheckedHover="Images/Stop_hover.png"
        />

      <btn:ImageToggleButton
        x:Name="btnPlay"
        Visibility="{Binding Path=PlayCommand.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
        IsEnabled="{Binding Path=PlayCommand.IsEnabled, Mode=TwoWay}"
        IsChecked="{Binding Path=PlayCommand.IsChecked, Mode=TwoWay}"
        Margin="3,0,3,0"
        ToolTipService.ToolTip="Play audio"
        Image="Images/Play.png"
        ImageHover="Images/Play_hover.png"
        ImageChecked="Images/Stop.png"
        ImageCheckedHover="Images/Stop_hover.png"
        />

      <btn:ImageButton
        x:Name="btnLoad"
        Command="{Binding LoadCommand}"
        Visibility="{Binding Path=LoadCommand.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
        Margin="0,0,3,0"
        ToolTipService.ToolTip="Load audio from .WAV file"
        Image="Images/LoadAudio.png"
        ImageHover="Images/LoadAudio_hover.png"
        />

      <btn:ImageButton
        x:Name="btnSave"
        Command="{Binding SaveCommand}"
        Visibility="{Binding Path=SaveCommand.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
        Margin="0,0,3,0"
        ToolTipService.ToolTip="Save audio to .WAV file"
        Image="Images/SaveAudio.png"
        ImageHover="Images/SaveAudio_hover.png"
        />

    </StackPanel>

  </DockPanel>

</UserControl>
